package com.example.demo.control;

import com.example.demo.common.CommonResult;
import com.example.demo.pojo.MultiChoice;
import com.example.demo.pojo.SingleChoice;
import com.example.demo.pojo.TFChoice;
import com.example.demo.service.MultiChoiceService;
import com.example.demo.service.SingleChoiceService;
import com.example.demo.service.TFChoiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "修改接口")
@RestController
public class UpdateController {

    @Autowired
    private SingleChoiceService singleChoiceService;
    @Autowired
    private MultiChoiceService multiChoiceService;
    @Autowired
    private TFChoiceService tfChoiceService;

    @ApiOperation(value = "添加单选题")
    @PostMapping("/addSingleChoice")
    public CommonResult addSingleChoice(@RequestBody SingleChoice singleChoice){
        singleChoiceService.add(singleChoice);
        return CommonResult.success("");
    }

    @ApiOperation(value = "删除单选题")
    @GetMapping("/deleteSingleChoice")
    public CommonResult deleteSingleChoice(@RequestParam Integer user_id){
        singleChoiceService.delete(user_id);
        return CommonResult.success("");
    }

    @ApiOperation(value = "添加多选题")
    @PostMapping("/addMultiChoice")
    public CommonResult addMultiChoice(@RequestBody MultiChoice multiChoice){
        multiChoiceService.add(multiChoice);
        return CommonResult.success("");
    }

    @ApiOperation(value = "删除多选题")
    @GetMapping("/deleteMultiChoice")
    public CommonResult deleteMultiChoice(@RequestParam Integer user_id){
        multiChoiceService.delete(user_id);
        return CommonResult.success("");
    }

    @ApiOperation(value = "添加判断题")
    @PostMapping("/addTFChoice")
    public CommonResult addTFChoice(@RequestBody TFChoice tfChoice){
        tfChoiceService.add(tfChoice);
        return CommonResult.success("");
    }

    @ApiOperation(value = "删除判断题")
    @GetMapping("/deleteTFChoice")
    public CommonResult deleteTFChoice(@RequestParam Integer user_id){
        tfChoiceService.delete(user_id);
        return CommonResult.success("");
    }
}
